<?php

/**
 * search actions.
 *
 * @package    Your name
 * @subpackage search
 * @author     John Doe <you@example.com>
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class searchActions extends FrontendActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->form = new BlogPostFormFilter($request->getParameter('q') ? array('title' => $request->getParameter('q')) : array());
    $this->form->setQuery(Doctrine_Core::getTable('BlogPost')->getPublishedPostsQuery($this->getUser()->getCulture()));
    
    $query = null;
    if ($this->form->isValid())
    {
      $query = $this->form->getQuery();
    }
    
    $this->pager = $this->getPostsPager($request, $query);
  }
}
